import http from '../http/'

export default async () => {
	let params = {};
	const res = await http.post('/api/wxoauth/getJsconfig', {
		jsApiList: [],
		url: window.location.href.split('#')[0]
	})
	if (!res.code) params = res.data;
	// 微信配置
	wx.config({
		debug: false,
		appId: params.appId,
		timestamp: params.timestamp,
		nonceStr: params.nonceStr,
		signature: params.signature,
		jsApiList: [
			"updateAppMessageShareData",
			"updateTimelineShareData",
			"onMenuShareAppMessage", // 分享给朋友
			"onMenuShareTimeline", // 分享到朋友圈
			"onMenuShareQQ", // 分享到QQ
			"onMenuShareQZone", // 分享到QQ空间
			"checkJsApi" //判断当前客户端版本是否支持指定JS接口
		],
		openTagList: ['wx-open-launch-weapp']
	});

	wx.ready(function () {

	});

	wx.error(function(){

	});
}
